

BUILDDIR=.

ifeq ($(RELEASE),)
	RELEASE = $(shell $(M_DIR_UTILS)/release.sh)
endif
ifeq ($(STAGE),)
	STAGE = $(shell $(M_DIR_UTILS)/stage.sh)
endif


DEBUG		= # -DDEBUG # Uncomment to turn on debugging

CFLAGS += -DKERNEL $(DEBUG) -D_KVERSION_=\"$(RELEASE)-$(STAGE)\"

LFLAGS += -nostdlib -L$(LIBDIR) -static -Wl,-warn-common,-X,--oformat,elf32-i386,-e,kernelMain,-Ttext,0xC0000000 
LFLAGS_EXE = 


# kernelMain needs to go first
NAMES = \
	kernelMain \
	kernelApi \
	kernelBus \
	kernelDebug \
	kernelDescriptor \
	kernelDevice \
	kernelDisk \
	kernelDma \
	kernelDriver \
	kernelEncryptMD5 \
	kernelEnvironment \
	kernelError \
	kernelFile \
	kernelFileStream \
	kernelFilesystem \
	kernelFilesystemExt \
	kernelFilesystemFat \
	kernelFilesystemIso \
	kernelFilesystemLinuxSwap \
	kernelFilesystemNtfs \
	kernelFont \
	kernelGraphic \
	kernelImage \
	kernelImageBmp \
	kernelImageIco \
	kernelImageJpg \
	kernelInitialize \
	kernelInterrupt \
	kernelInterruptX86 \
	kernelKeyboard \
	kernelLinkedList \
	kernelLoader \
	kernelLoaderClass \
	kernelLoaderElf \
	kernelLock \
	kernelLog \
	kernelMalloc \
	kernelMemory \
	kernelMouse \
	kernelMisc \
	kernelMultitasker \
	kernelNetwork \
	kernelNetworkDevice \
	kernelNetworkStream \
	kernelPage \
	kernelPic \
	kernelPerformanceCounter \
	kernelProcessorX86 \
	kernelProcessorLevel \
	kernelRandom \
	kernelRtc \
	kernelShutdown \
	kernelStream \
	kernelSysTimer \
	kernelText \
	kernelUser \
	kernelVariableList \
	kernelWindow \
	kernelWindowBorder \
	kernelWindowButton \
	kernelWindowCanvas \
	kernelWindowCheckbox \
	kernelWindowComponent \
	kernelWindowContainer \
	kernelWindowEventStream \
	kernelWindowIcon \
	kernelWindowImage \
	kernelWindowList \
	kernelWindowListItem \
	kernelWindowMenu \
	kernelWindowMenuBar \
	kernelWindowMenuItem \
	kernelWindowPasswordField \
	kernelWindowProgressBar \
	kernelWindowRadioButton \
	kernelWindowScrollBar \
	kernelWindowShell \
	kernelWindowSlider \
	kernelWindowSysContainer \
	kernelWindowTextArea \
	kernelWindowTextField \
	kernelWindowTextLabel \
	kernelWindowTitleBar

DRIVERNAMES = \
	kernelDmaDriver \
	kernelFloppyDriver \
	kernelFramebufferGraphicDriver \
	kernelGraphicConsoleDriver \
	kernelIdeDriver \
	kernelLanceDriver \
	kernelPciDriver \
	kernelPicDriver \
	kernelPs2KeyboardDriver \
	kernelPs2MouseDriver \
	kernelRtcDriver \
	kernelScsiDiskDriver \
	kernelSysTimerDriver \
	kernelSystemDriver \
	kernelTextConsoleDriver \
	kernelUsbDriver \
	kernelUsbEhciDriver \
	kernelUsbHidDriver \
	kernelUsbHubDriver \
	kernelUsbOhciDriver \
	kernelUsbUhciDriver

ALLNAMES = $(NAMES) $(DRIVERNAMES)
KERNEL = alkrnl
SYMBOLS = $(M_DIR_BUILD)/$(M_P_SYSTEM)/kernelSymbols.txt

TARGETS  = $(KERNEL)
SOURCES  = $(ALLNAMES)
USING_LIB_A = kc 
USING_LIB_NO_DEP = gcc

CMD_AFTER_BUILD_T_$(KERNEL) = $(M_DIR_UTILS)/kernel-symbols.sh $@ $(SYMBOLS) &&
CFLAGS_O_kernelApi = -O0 -Wno-strict-prototypes $(Wno_missing_format_attribute)

include $(M_MAKEBUILD)
 

